Example #1
0
        public T Save()
        {
            var entity       = State as IEntity;
            var identityUser = State as IdentityUser;

            if (entity != null)
            {
                if (Context.Entry(entity).State != EntityState.Modified)
                {
                    Context.Add(entity);
                }
            }
            else if (identityUser != null)
            {
                Context.Add(identityUser);
            }
            else if (State is IdentityRole)
            {
                Context.Add(State);
            }
            else
            {
                throw new BuilderSaveException($"State {State} has to be an Entity or IdentityUser.");
            }

            Context.SaveChanges();
            return((T)this);
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "Admission_Number,Full_Name,Nationality,Mother_Tonguage,Religion,Caste,Subcaste,DateOfBirth,BirthDate_in_Words,Birth_Place")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(student));
 }
Example #3
0
 public void Put(int id, [FromBody] Student student)
 {
     _dbcontext.Entry(_dbcontext.Students.Where(X => X.AdmissionNumber == id).FirstOrDefault()).CurrentValues.SetValues(student);
     _dbcontext.SaveChanges();
 }
Example #4
0
 public void Put(string id, [FromBody] StaffeLetter staffeLetter)
 {
     _dbcontext.Entry(_dbcontext.StaffeLetters.Where(X => X.Empid == id).FirstOrDefault()).CurrentValues.SetValues(staffeLetter);
     _dbcontext.SaveChanges();
 }
		public void Put(int id, [FromBody] StudentFeedback studentFeedbackReq)
		{
			_dbcontext.Entry(_dbcontext.StudentFeedbacks.Where(X => X.StudentFeedbackId == id).FirstOrDefault()).CurrentValues.SetValues(studentFeedbackReq);
			_dbcontext.SaveChanges();
		}
Example #6
0
 public async Task Put(int id, [FromBody] Staff staff)
 {
     _dbcontext.Entry(_dbcontext.Staffs.Where(X => X.Mobile == id).FirstOrDefault()).CurrentValues.SetValues(staff);
     await _dbcontext.SaveChangesAsync();
 }