Skip to content

Instantly share code, notes, and snippets.

View kleberksms's full-sized avatar

Kleber Syd Moraes da Silva kleberksms

View GitHub Profile
[HttpPost]
[Route("{system}/{company}/{user}")]
public IActionResult Post([FromBody] CompanyEvaluationViewModel companyEvaluationViewModel)
{
if (!ModelState.IsValid)
{
NotifyModelStateErrors();
return Response(companyEvaluationViewModel);
}
using System.Linq;
using AvaliacoesEmpresas.Domain.Interfaces;
using AvaliacoesEmpresas.Domain.Models;
using AvaliacoesEmpresas.Infra.Data.Context;
using Microsoft.EntityFrameworkCore;
namespace AvaliacoesEmpresas.Infra.Data.Repository
{
public class EvaluationRepository : Repository<Evaluation>, IEvaluationRepository
{
public Evaluation GetEvaluationByCompany(string client, string company)
{
return DbSet.AsNoTracking().FirstOrDefault(c => c.Fk_Company == company && c.Client == client);
}
//EvaluationListViewModel
public EvaluationListViewModel GetEvaluationListByCompany(string client, string company)
{
var result = DbSet.AsQueryable()
@kleberksms
kleberksms / disable-web-security.md
Created August 9, 2018 16:47 — forked from dongyuwei/disable-web-security.md
how to disable same origin policy in chrome , for ubuntu users.

how to disable same origin policy in chrome , for ubuntu users.

vim /usr/share/applications/google-chrome.desktop

Exec=/opt/google/chrome/google-chrome --incognito --disable-web-security

--disable-web-security is the key.

@kleberksms
kleberksms / databinding.cshtml
Last active May 30, 2018 21:08
DataBinding
<p class="note @((Foo == "Bar" ? "highlight" : ""))">This is a note</p>
<!-- OR -->
<p class="note @((Foo == Bar ? "highlight" : ""))">This is a note</p>
@functions {
private string Foo { get; set; } = "Bar";
private string Bar { get; set; }
jQuery(function ($) {
$(document).ready(function () {
$('.modal-loading').show();
//########## Manipulação HTML ##########
getUf();
getBancos();
getAcao();
getPublicacao();
{
"description": "Crm Gateway Shared Kernel",
"authors": [ "bp" ],
"packOptions": {},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
{System.ObjectDisposedException: Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling Dispose() on the context, or wrapping the context in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.
Object name: 'SistemaJuridicoContext'.
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
at Microsoft.EntityFrameworkCore.DbContext.get_ChangeTracker()
at Microsoft.EntityFrameworkCore.Query.CompiledQueryCacheKeyGenerator.GenerateCacheKeyCore(Expression query, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.RelationalCompiledQueryCacheKeyGenerator.GenerateCacheKeyCore(Expression query, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.RelationalCompiledQueryCacheKeyGen
public class MyContext : DbContext
{
public MyContext(DbContextOptions<MyContext> options) :base(options)
{ }
public DbSet<Obj1> Obj1s { get; set; }
}
//Models
public class Comarca
{
public Comarca(){}
public Comarca(string descricao, Guid ufId)
{
Id = Guid.NewGuid();
Descricao = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(descricao);