public string SaveBlock(utblMstBlock model) { var parBlockID = new SqlParameter("@BlockID", model.BlockID); var parDistCode = new SqlParameter("@DistCode", model.DistCode); var parBlockName = new SqlParameter("@BlockName", model.BlockName); var parTransDate = new SqlParameter("@TransDate", model.TransDate); var parUserID = new SqlParameter("@UserID", model.UserID); return(db.Database.SqlQuery <string>("udspBlockSave @BlockID,@DistCode, @BlockName, @TransDate, @UserID", parBlockID, parDistCode, parBlockName, parTransDate, parUserID).FirstOrDefault()); }
public string DeleteBlock(long id) { try { utblMstBlock model = db.utblMstBlocks.Find(id); db.utblMstBlocks.Remove(model); db.SaveChanges(); return("Block Removed"); } catch (Exception) { return("Error: Server error, try again later"); } }