public Dalyan.Entities.Models.SampleTable Handler(SampleTableAddQuery query) { try { var obj = new Dalyan.Db.SampleTable(); obj.Id = query.SampleTable.Id; obj.Name = query.SampleTable.Name; obj.CompanyId = query.SampleTable.CompanyId; obj.Gender = query.SampleTable.Gender; obj.Active = query.SampleTable.Active; obj.Movies = query.SampleTable.Movies; obj.Series = query.SampleTable.Series; obj.ProfilePicture = query.SampleTable.ProfilePicture; obj.LoginDate = query.SampleTable.LoginDate; obj.LongLoginDate = query.SampleTable.LongLoginDate; obj.LongText = query.SampleTable.LongText; obj.Price = query.SampleTable.Price; obj.Price2 = query.SampleTable.Price2; obj.CreatedDate = query.SampleTable.CreatedDate; obj.CreatedIpAddress = query.SampleTable.CreatedIpAddress; obj.CreatedUserId = query.SampleTable.CreatedUserId; obj.UpdatedDate = query.SampleTable.UpdatedDate; obj.UpdatedIpAddress = query.SampleTable.UpdatedIpAddress; obj.UpdatedUserId = query.SampleTable.UpdatedUserId; obj.IsDeleted = query.SampleTable.IsDeleted; _db.SampleTable.Add(obj); _db.SaveChanges(); query.SampleTable.Id = obj.Id; return(query.SampleTable); } catch (Exception ex) { throw new ExceptionLog(LogType.DATABASE_INSERT, LogLevel.ERROR, ex, "AddQueryHandler"); } }
public bool Handler(Dalyan.Domain.Query.SampleTableDeleteQuery query) { try { var obj = new Dalyan.Db.SampleTable(); obj = _db.SampleTable.FirstOrDefault(x => x.Id == query.Id); obj.IsDeleted = true; _db.SaveChanges(); return(true); } catch (Exception ex) { throw new ExceptionLog(LogType.DATABASE_DELETE, LogLevel.ERROR, ex, "DeleteQueryHandler"); } }